package net.arogarth.aws.android.manager.views;

import net.arogarth.aws.android.manager.R;
import net.arogarth.aws.android.manager.dbmodels.AwsAccount;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class CreateNewAwsAccount extends Activity {
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        setContentView(R.layout.create_new_aws_account);
    }
	
	public void onClickSave(View v) {
		CharSequence name = ((TextView) findViewById(R.id.tvAccountname)).getText();
		CharSequence accessKey = ((TextView) findViewById(R.id.tvAccessKey)).getText();
		CharSequence secretKey = ((TextView) findViewById(R.id.tvSecretKey)).getText();

		AwsAccount account = new AwsAccount();
		account.setName(name.toString());
		account.setAccessKey(accessKey.toString());
		account.setSecretKey(secretKey.toString());
		account.save();
		
		finish();
	}
}
